<p style="margin-bottom: 0px">&nbsp;</p>
<nz-card>
  <form nz-form [nzLayout]="'inline'" class="search__form">
    <nz-row [nzGutter]="8">
      <nz-col nzMd="6" nzSm="24">
        <nz-form-item>
          <nz-form-control>
            <input nz-input [(ngModel)]="q.username" name="username" placeholder="{{ 'enterAccount' | translate }}" id="account">
          </nz-form-control>
        </nz-form-item>
      </nz-col>
      <nz-col nzMd="6" nzSm="24">
        <nz-form-item>
          <nz-form-control>
            <input nz-input [(ngModel)]="q.name" name="name" placeholder="{{ 'enterName' | translate }}" id="name">
          </nz-form-control>
        </nz-form-item>
      </nz-col>
      <nz-col nzMd="6" nzSm="24">
        <button nz-button type="button" [nzType]="'primary'" (click)="st.load(1, q)">{{'search' | translate}}</button>
      </nz-col>
    </nz-row>
  </form>
</nz-card>
<!-- <button nz-button style="margin-bottom: 8px" (click)="add()" [nzType]="'default'"><i class="anticon anticon-plus"></i>{{'add' | translate}}</button> -->

<button [nzLoading]="loading" nz-popconfirm nz-button nzType='default' style="margin-right: 8px"
    [nzTitle]="repdateinput"
    (nzOnConfirm)="sync()" (nzOnCancel)="cancelSync()">
    <i class="anticon anticon-sync"></i>{{ 'syncSap' | translate }}
</button>
<ng-template #repdateinput>
  <nz-date-picker nzFormat="yyyyMMdd" name="repdate" [(ngModel)]="repdate"></nz-date-picker>
</ng-template>

<button nz-button style="margin-bottom: 8px" (click)="openConfig()"  [nzType]="'default'">{{'batchConfigPrice' | translate}}</button>

<!--<nz-dropdown style="margin-bottom: 8px;margin-left: 10px;">-->
  <!--<button nz-button nz-dropdown>{{'uploadConfigPrice' | translate}}</button>-->
  <!--<ul nz-menu>-->
    <!--<li nz-menu-item>-->
      <!--<a>-->
        <!--<nz-upload [nzAction]="uploadUrl" [nzShowUploadList]="false" nzAccept="application/vnd.ms-excel" -->
                  <!--(nzChange)="handleChange2($event)" [nzData]="extraParam2">          -->
            <!--<i class="anticon anticon-upload"></i>{{'uploadConfigPriceDollor' | translate}}          -->
        <!--</nz-upload>-->
      <!--</a>-->
    <!--</li>-->
    <!--<li nz-menu-item>      -->
      <!--<a down-file (click)="download()" file-name="价格模板">-->
        <!--<i class="anticon anticon-download"></i>{{'downloadPriceTemplate'|translate}}-->
      <!--</a>      -->
    <!--</li>-->
  <!--</ul>-->
<!--</nz-dropdown>-->

<!-- <nz-upload #upload [nzAction]="uploadUrl" [nzShowUploadList]="false" nzAccept="application/vnd.ms-excel" (nzChange)="handleChange($event)"
   [nzData]="extraParam" style="margin-left: 8px">
  <button nz-button [nzLoading]="loading">
    <span>{{'uploadConfigPrice' | translate}}</span>
  </button>
</nz-upload> -->

<nz-dropdown style="margin-bottom: 8px;margin-left: 10px;">
  <button nz-button nz-dropdown>Batch config label</button>
  <ul nz-menu>
    <li nz-menu-item>
      <a>
        <nz-upload [nzAction]="uploadCurrencyCodeLabelUrl" [nzShowUploadList]="false" nzAccept="application/vnd.ms-excel" (nzChange)="handleChange3($event)">
          <i class="anticon anticon-upload"></i>Upload templete
        </nz-upload>
      </a>
    </li>
    <li nz-menu-item>
      <a down-file [http-data]="data" http-url="assets/tmp/setCurrencyCodeLabel.xls" file-name="SetCurrencyCodeLabel">
          <i class="anticon anticon-download"></i>Download templete
      </a>
    </li>
  </ul>
</nz-dropdown>

<!--<button nz-popconfirm nz-button nzType='default' style="margin-top: 8px; margin-left: 8px;"-->
      <!--[nzTitle]="currencyinput"-->
      <!--(nzOnConfirm)="setCurrency()" (nzOnCancel)="cancel()">{{ 'batchConfigCurrency' | translate }}-->
<!--</button>-->
<!--<ng-template #currencyinput>-->
    <!--<nz-select [(ngModel)]="currency" name="currency" style="width: 100px;">-->
      <!--<nz-option *ngFor="let option of currencys" [nzLabel]="option.text" [nzValue]="option.value"></nz-option>-->
    <!--</nz-select>-->
<!--</ng-template>-->

<!--<button nz-popconfirm nz-button nzType='default' style="margin-top: 8px; margin-left: 8px;"-->
      <!--[nzTitle]="siteinput"-->
      <!--(nzOnConfirm)="setSiteCode()" (nzOnCancel)="cancel2()">{{ 'batchConfigSiteCode' | translate }}-->
<!--</button>-->
<!--<ng-template #siteinput>-->
    <!--<nz-select [(ngModel)]="siteCode" name="siteCode" style="width: 100px;">-->
      <!--<nz-option *ngFor="let option of siteCodes" [nzLabel]="option.text" [nzValue]="option.value"></nz-option>-->
    <!--</nz-select>-->
<!--</ng-template>-->

<!--<button nz-popconfirm nz-button nzType='default' style="margin-top: 8px; margin-left: 8px;"-->
      <!--[nzTitle]="labelinput"-->
      <!--(nzOnConfirm)="setLabel()" (nzOnCancel)="cancel3()">{{ 'batchConfigLabel' | translate }}-->
<!--</button>-->
<!--<ng-template #labelinput>-->
    <!--<nz-select [(ngModel)]="label" name="label" style="width: 100px;">-->
      <!--<nz-option *ngFor="let option of labels" [nzLabel]="option.text" [nzValue]="option.value"></nz-option>-->
    <!--</nz-select>-->
<!--</ng-template>-->

<simple-table #st
  [columns]="columns"
  [data]="url"
  [ps]="ps"
  [extraParams]="q"
  [resReName]="{ total: 'data.total', list: 'data.rows'}"
  [reqReName]="{pi:'pageNumber', ps: 'pageSize'}"
  toTopInChange
  [showTotal]="true"
  [showPagination]="true"
  [showSizeChanger]="true"
  (checkboxChange)="checkboxChange($event)">
  <ng-template st-row="isDisabled" let-item let-index="index">
    <nz-badge *ngIf="item.isDisabled === '1'" nzStatus="error" nzText="{{'disable' | translate}}"></nz-badge>
    <nz-badge *ngIf="item.isDisabled === '0'" nzStatus="success" nzText="{{'normal' | translate }}"></nz-badge>
  </ng-template>
  <ng-template st-row="label" let-item let-index="index">
    {{item.label | uppercase}}
  </ng-template>
  <ng-template st-row="address" let-item let-index="index">
    <div class="text-truncate" style="width: 200px">{{item.address}}</div>
  </ng-template>
  <ng-template st-row="priceConfig" let-item let-index="index">
    <nz-tooltip [nzTitle]="item.priceConfig === 'CALC' ? ('Orig ' +  getMethod(item.priceMethod) + ' ' + item.priceCalc)  : ''">
        <span nz-tooltip><nz-tag [nzColor]="item.priceConfig === 'DEFAULT' ? 'green' : item.priceConfig === 'CALC' ? 'red': 'purple'">{{item.priceConfig | lowercase}}</nz-tag></span>
    </nz-tooltip>
  </ng-template>
</simple-table>
